<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class News extends Model
{
    use HasFactory;
    use SoftDeletes;
    protected $guarded=[];
    protected $table='zfm_news';
    /**
     * 资讯信息展示
     * @return mixed
     */
    public static function list(){
        return self::orderby('id','desc')->paginate(10);
    }
    /**
     * 资讯信息查找
     * @param $where
     * @return mixed
     */
    public static function Seek($field,$where){
        return self::where($field,'like',"%$where%")->get();
    }
    /**
     * 资讯信息删除
     */
    public static function del($id,$fangId){
        return self::where([$id=>$fangId])
            ->delete();
    }
    /**
     * 资讯详情信息
     */
    public static function detail($field,$where){
        return self::where($field,$where)->first();
    }
    /**
     * 资讯信息修改
     */
    public static function change($field,$fangID,$SecondaryMessageUpdated){
        return self::where($field,$fangID,$fangID)->update($SecondaryMessageUpdated);
    }
}
